﻿using Quartz;

namespace SqlSugarWebApi.Quartz.QuartzJob
{
    [DisallowConcurrentExecution]
    public class MyJobs : IJob
    {
        IServiceProvider _serviceProvider;
        public MyJobs(IServiceProvider serviceProvider)
        {
            _serviceProvider = serviceProvider;
        }

        public async Task Execute(IJobExecutionContext context)
        {
            using (IServiceScope scope = _serviceProvider.CreateScope())
            {
                //var jobStateRepository = scope.ServiceProvider.GetRequiredService<IJobStateRepository>();
                //var jobstate = new JobState { State_Desc = "test", Color = 65535, Last_Edit_At = DateTime.Now, Last_Edit_By = String.Empty, Last_Edit_Comment = String.Empty };
                //await jobStateRepository.AddAsync(jobstate);
                //await jobStateRepository.SaveAsync();
            }
        }
    }
}
